package com.ocm.warehouse.feign;

import com.ocm.core.launch.constant.AppConstant;
import com.ocm.core.tool.api.R;
import com.ocm.warehouse.bo.StockLockBO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.constraints.NotNull;

@FeignClient(
	value = AppConstant.APPLICATION_WAREHOUSE_NAME,
	fallback = IStockFallback.class
)
public interface IStockClient {

	String API_PREFIX = "/stock";


	@GetMapping(API_PREFIX+"hasStockBySpuId")
	R<Boolean> hasStockBySpuId(@RequestParam("id") @NotNull Long spuId);

	@PostMapping(API_PREFIX+"stockLock")
	R<Long> stockLock(@RequestBody StockLockBO stockLocks);

	@PostMapping(API_PREFIX+"stockUnlock")
	R stockUnLock(@RequestBody Long orderId);

}
